Description:
RVNC checks that values returned by functions are used correctly.
A warning message is produced when a function is called at least once, but its return value is never used. For methods that are not used, a MNU (member is not used) warning is produced instead. Method overriding is considered, i.e., it is assumed that if a concrete method is called, all methods from the derived classes that override it can be called instead of this method.
Another warning message is produced when values returned by a method are used by some callers, but are ignored by others. For methods that return error codes, ignoring the returned value may make error detection and handling more difficult.
Incorrect:
Buffer = class
private
function Extend(size:integer):boolean;
public
procedure Add(obj:TObject);
end;
...
procedure Buffer.Add(obj:TObject);
begin
...
Extend(delta);
...
end;
Correct:
procedure Buffer.Add(obj:TObject); begin ... if Extend(delta) then ... end;